Repository navigation
DOC: Show how to build a custom LLM converter with LLMGenericTextConverter - #4502
avaldivieso-meraki wants to merge 1 commit into
Conversation
Add a short subsection to the LLM-Based Converters page explaining when to use LLMGenericTextConverter directly and showing a minimal example with a system_prompt_template, the objective placeholder, and an extra template parameter. Mention subclassing and overriding _process_response when the response needs parsing. Update both the jupytext .py and paired .ipynb; the example calls an LLM, so the new cells have no saved outputs.
|
avaldivieso-meraki please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the paired documentation update, though the new example was not executed because no endpoint was configured.
No open issues 🎉
What changed in this PR
Documents how to use LLMGenericTextConverter directly for custom LLM rewrites when no built-in converter fits, addressing #4498.
Changes:
- Adds an example using
system_prompt_template, the incomingobjective, and an extrastyleparameter. - Explains subclassing and overriding
_process_responsewhen output needs parsing. - Updates both paired documentation files; the new example remains unexecuted because no endpoint was configured.
| File | Description |
|---|---|
doc/code/converters/1_text_to_text_converters.py |
Adds the custom converter guidance and example. |
doc/code/converters/1_text_to_text_converters.ipynb |
Mirrors the new subsection with no saved execution output. |
Review effort: Balanced
Description
This adds a short subsection to the "LLM-Based Converters" section of the text-to-text converters page showing how to use
LLMGenericTextConverterdirectly as a one-off custom LLM converter. It covers when to reach for it, a minimal working example, and the_process_responsesubclassing alternative.Closes #4498
LLMGenericTextConverter": use case, minimal example (system_prompt_template, incoming prompt asobjective, and an extrastyleparameter forwarded to the template), and a one-sentence note on subclassing and overriding_process_responsewhen the LLM output needs parsing.1_text_to_text_converters.pyand.ipynb) in sync, and checked the example against the class's current constructor signature and unit tests.Both files were edited by hand and the notebook was not re-executed, because this example calls an LLM and no endpoint was configured locally; the new cells therefore have no saved outputs. The official test/lint commands (pytest, ruff, pre-commit,
jupytext --execute) were not run because those tools are not installed in this environment. The checks that were available did pass:git diff --check, Python syntax,.py/.ipynbsource parity, notebook JSON structure, andpython -m build_scripts.validate_docs(172 references validated, no orphaned docs).